import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class PayrollMapper extends Mapper<LongWritable,Text,PayrollSortBean,Text> {


    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[] split = value.toString().split(",");
        if (split[0].length() !=0 & !split[0].equals("null")) {
            double salary = Double.parseDouble(split[5] )+Double.parseDouble(split[6]);
            PayrollSortBean payrollSortBean = new PayrollSortBean(salary);
            Text text = new PayrollDateFomat().PingJie(value);
            context.write(payrollSortBean,text);
        }
    }
}